nclude <iostream>
using namespace std;
#include <vector>
#include <algorithm>

void test1(){
    char *ptr;
    char myString[] = "abcdefg";
    ptr = myString;
    ptr+=5;
    cout << *ptr <<endl;
}

void test2(){
    char a[10] = {'1','2','3','4','5','6','7','8','9',0};
    int i = 8;
    char *p = a + i;
    printf("%s\n",p-3);
    printf("%s\n",a);
}

void test3(){
    long long a = 1, b = 2, c = 3;
    printf("%d %d %d\n",a,b,c);
}



bool isNumb(char c){
    return c <= '9' && c >= '0';
}

void Test1(){
    string str,res,cur;
    cin >> str;
    for (int i = 0; i <= str.size(); ++i) {
        if (isNumb(str[i]))
            cur += str[i];
        else{
            if (res.size() < cur.size())
                res = cur;
            cur.clear();
        }
    }
    cout << res << endl;
}


class Solution{
public:
    int MoreThanHalfNum_Solution(vector<int>& numbers){
        sort(numbers.begin(),numbers.end());
        int mode = numbers[numbers.size()/2];
        int count = 0;
        for (auto pc:numbers) {
            if (mode == pc)
                ++count;
        }
        if(count > numbers.size()/2)
            return mode;
        return 0;
    }
};

void Test2(){
    vector<int> v = {1, 2, 3, 2, 2, 2, 3, 4, 2};
    size_t ret = Solution().MoreThanHalfNum_Solution(v);
    cout << ret << endl;
}

